import request from '/@/utils/request';

/**
 * 后端控制菜单模拟json，路径在 https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu
 * @method getMenu 获取路由菜单
 */
export function useMenuApi() {
	return {
		// 查询菜单列表
		listMenu: (query: any) => {
			return request({
				url: '/system/menu/list',
				method: 'get',
				params: query,
			});
		},
		// 查询菜单（精简)列表
		listSimpleMenus: () => {
			return request({
				url: '/system/menu/list-all-simple',
				method: 'get',
			});
		},
		// 查询菜单详细
		getMenu: (id: any) => {
			return request({
				url: '/system/menu/get?id=' + id,
				method: 'get',
			});
		},
		// 新增菜单
		addMenu: (data: any) => {
			return request({
				url: '/system/menu/create',
				method: 'post',
				data: data,
			});
		},
		// 修改菜单
		updateMenu: (data: any) => {
			return request({
				url: '/system/menu/update',
				method: 'put',
				data: data,
			});
		},
		// 删除菜单
		delMenu: (id: any) => {
			return request({
				url: '/system/menu/delete?id=' + id,
				method: 'delete',
			});
		},
	};
}
